package part21_建造者模式_建房项目.p01_升级;

/**
 * @ClassName: HouseDirector
 * @Author: AllenSun
 * @Date: 2020/3/9 23:22
 */
public class HouseDirector {
    HouseBuilder houseBuilder=null;

    //把构造器传入 houseBuilder
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //通过setter传入houseBuilder
    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //如何处理建造房子的流程，交给指挥者
    public House constructHouse(){
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return houseBuilder.buildHouse();
    }
}
